import { getNote } from "@/lib/redis.js";
import Note from "@/components/Note.jsx";

async function NotePage({params}) {
    const { id } = await params;
    const note = await getNote(id);

    const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
    await sleep(2000); // 模拟加载时间
    
    console.log(note);
    if (!note) {
        return (
            <div className="note--empty-state">
                <span className="note-text--empty-state">
                    Note not found
                </span>
            </div>
        )
    }
    
    
    return (
        <Note noteId={id} note={note}></Note>
    )
}
export default NotePage